package com.wwk.phone.controller;

import com.wwk.phone.service.OssService;
import com.wwk.phone.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/kaioss/fileoss")
@CrossOrigin
public class OssController {
    @Autowired
    private OssService ossService;

    @PostMapping
    public R uploadOssFile(@RequestParam("file") MultipartFile file) {
        //获取上传的文件，MultipartFile，
        //返回上传oss的url
        System.out.println("进入文件上传");
        String url = ossService.upload(file);
        return R.ok().data("url", url);
    }
}
